$(function(){
	$('#datalist').datagrid({
		data:[],
		fit:true,
		toolbar:"#searchtools",
        columns:[[
            {field:'id',title:'单词',width:120,align:'center'},
            {field:'analyzeId',title:'单词Id',width:120,align:'center'},
            {field:'analyze',title:'释义',width:700,align:'center'}
        ]]
    });
	
	$("#querybtn").on("click", function(){
		var keyword = $("input[name='keyword']").val();
		keyword = encodeURI(keyword);
		$.post(ctx+"/search",{"keyword":keyword},function(returnDto){
			returnDto = eval("("+returnDto+")");
			if(returnDto.status){
				$('#datalist').datagrid('loadData',returnDto.content.result.result); 
			}else{
				$.messager.alert('温馨提示',returnDto.message);
				return false;				
			}
		});
	});
	
});